package com.clqteam.serviceimpl;

import java.util.List;

import com.clqteam.dao.VIPDao;
import com.clqteam.daoimpl.VIPDaoImpl;
import com.clqteam.model.VIP;
import com.clqteam.service.VIPService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class VIPServiceImpl implements VIPService{

	VIPDao vDao = new VIPDaoImpl();
	
	@Override
	public JSONObject findVIPInfoByVId(int vId) {
		JSONObject j = new JSONObject();
		VIP vip = vDao.getVIPInfoByVId(vId);
		JSONArray js = new JSONArray();
		js.add(vip);
		j.put("total", 1);
		j.put("rows", js);
		return j;
	}

	@Override
	public JSONObject findAllVIPInfo() {
		JSONObject j = new JSONObject();
		List<VIP> vips = vDao.getAllVIPInfo();
		int total = vDao.getCountAllVIP();
		j.put("total", total);
		j.put("rows", vips);
		return j;
	}

}
